/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.jili.ubert.dao.db;

import java.io.Serializable;
import com.baidu.bjf.remoting.protobuf.Codec;
import com.baidu.bjf.remoting.protobuf.ProtobufProxy;
import com.baidu.bjf.remoting.protobuf.annotation.Protobuf;
import com.jili.ubert.code.CodeTool;
import java.io.IOException;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author dragon
 */
@Entity
@Table(name = "trade_sim_orderquene")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "TradeSimOrderQuene.findAll", query = "SELECT t FROM TradeSimOrderQuene t"),
    @NamedQuery(name = "TradeSimOrderQuene.findByOrderID", query = "SELECT t FROM TradeSimOrderQuene t WHERE t.orderID = :orderID"),
    @NamedQuery(name = "TradeSimOrderQuene.findByOrdertype", query = "SELECT t FROM TradeSimOrderQuene t WHERE t.ordertype = :ordertype"),
    @NamedQuery(name = "TradeSimOrderQuene.findByAccountCode", query = "SELECT t FROM TradeSimOrderQuene t WHERE t.accountCode = :accountCode"),
    @NamedQuery(name = "TradeSimOrderQuene.findByDealerUserID", query = "SELECT t FROM TradeSimOrderQuene t WHERE t.dealerUserID = :dealerUserID"),
    @NamedQuery(name = "TradeSimOrderQuene.findByTime", query = "SELECT t FROM TradeSimOrderQuene t WHERE t.time = :time"),
    @NamedQuery(name = "TradeSimOrderQuene.findByTradeDate", query = "SELECT t FROM TradeSimOrderQuene t WHERE t.tradeDate = :tradeDate"),
    @NamedQuery(name = "TradeSimOrderQuene.findByDateTime", query = "SELECT t FROM TradeSimOrderQuene t WHERE t.dateTime = :dateTime"),
    @NamedQuery(name = "TradeSimOrderQuene.findByMac", query = "SELECT t FROM TradeSimOrderQuene t WHERE t.mac = :mac"),
    @NamedQuery(name = "TradeSimOrderQuene.findByIp4", query = "SELECT t FROM TradeSimOrderQuene t WHERE t.ip4 = :ip4"),
    @NamedQuery(name = "TradeSimOrderQuene.findByObj", query = "SELECT t FROM TradeSimOrderQuene t WHERE t.obj = :obj"),
    @NamedQuery(name = "TradeSimOrderQuene.findByMarketCode", query = "SELECT t FROM TradeSimOrderQuene t WHERE t.marketCode = :marketCode"),
    @NamedQuery(name = "TradeSimOrderQuene.findByClassCode", query = "SELECT t FROM TradeSimOrderQuene t WHERE t.classCode = :classCode"),
    @NamedQuery(name = "TradeSimOrderQuene.findByBs", query = "SELECT t FROM TradeSimOrderQuene t WHERE t.bs = :bs"),
    @NamedQuery(name = "TradeSimOrderQuene.findByOpenClose", query = "SELECT t FROM TradeSimOrderQuene t WHERE t.openClose = :openClose"),
    @NamedQuery(name = "TradeSimOrderQuene.findByPriceType", query = "SELECT t FROM TradeSimOrderQuene t WHERE t.priceType = :priceType"),
    @NamedQuery(name = "TradeSimOrderQuene.findByOrderPrice", query = "SELECT t FROM TradeSimOrderQuene t WHERE t.orderPrice = :orderPrice"),
    @NamedQuery(name = "TradeSimOrderQuene.findByOrderQty", query = "SELECT t FROM TradeSimOrderQuene t WHERE t.orderQty = :orderQty"),
    @NamedQuery(name = "TradeSimOrderQuene.findByHedgeFlag", query = "SELECT t FROM TradeSimOrderQuene t WHERE t.hedgeFlag = :hedgeFlag"),
    @NamedQuery(name = "TradeSimOrderQuene.findByPosID", query = "SELECT t FROM TradeSimOrderQuene t WHERE t.posID = :posID"),
    @NamedQuery(name = "TradeSimOrderQuene.findByExexSeq", query = "SELECT t FROM TradeSimOrderQuene t WHERE t.exexSeq = :exexSeq"),
    @NamedQuery(name = "TradeSimOrderQuene.findByWorkingQty", query = "SELECT t FROM TradeSimOrderQuene t WHERE t.workingQty = :workingQty"),
    @NamedQuery(name = "TradeSimOrderQuene.findByUnWorkingQty", query = "SELECT t FROM TradeSimOrderQuene t WHERE t.unWorkingQty = :unWorkingQty"),
    @NamedQuery(name = "TradeSimOrderQuene.findByCancelQty", query = "SELECT t FROM TradeSimOrderQuene t WHERE t.cancelQty = :cancelQty"),
    @NamedQuery(name = "TradeSimOrderQuene.findByExeQty", query = "SELECT t FROM TradeSimOrderQuene t WHERE t.exeQty = :exeQty")})
public class TradeSimOrderQuene implements Serializable {
	public static byte[] EnCode(TradeSimOrderQuene msg) throws IOException {
		Codec<TradeSimOrderQuene> Lcode = ProtobufProxy.create(TradeSimOrderQuene.class);
		return Lcode.encode(msg);
	}
	public static TradeSimOrderQuene DeCode(byte[] data) throws IOException {
	Codec<TradeSimOrderQuene> Lcode = ProtobufProxy.create(TradeSimOrderQuene.class);
		return Lcode.decode(data);
	}

    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "OrderID")
    @Protobuf
	private Integer orderID;
    @Column(name = "ordertype")
    @Protobuf
	private String ordertype;
    @Basic(optional = false)
    @Column(name = "AccountCode")
    @Protobuf
	private String accountCode;
    @Basic(optional = false)
    @Column(name = "DealerUserID")
    @Protobuf
	private String dealerUserID;
    @Basic(optional = false)
    @Column(name = "Time")
    @Temporal(TemporalType.TIME)
    private Date time;
	@Protobuf
	private long timeL;
    @Basic(optional = false)
    @Column(name = "TradeDate")
    @Temporal(TemporalType.DATE)
    private Date tradeDate;
	@Protobuf
	private long tradeDateL;
    @Basic(optional = false)
    @Column(name = "DateTime")
    @Temporal(TemporalType.TIMESTAMP)
    private Date dateTime;
	@Protobuf
	private long dateTimeL;
    @Column(name = "Mac")
    @Protobuf
	private String mac;
    @Column(name = "IP4")
    @Protobuf
	private Integer ip4;
    @Basic(optional = false)
    @Column(name = "Obj")
    @Protobuf
	private String obj;
    @Column(name = "MarketCode")
    @Protobuf
	private String marketCode;
    @Column(name = "ClassCode")
    @Protobuf
	private String classCode;
    @Column(name = "BS")
    @Protobuf
	private String bs;
    @Column(name = "OpenClose")
    @Protobuf
	private String openClose;
    @Column(name = "PriceType")
    @Protobuf
	private String priceType;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @Column(name = "OrderPrice")
    @Protobuf
	private Float orderPrice;
    @Column(name = "OrderQty")
    @Protobuf
	private Integer orderQty;
    @Column(name = "HedgeFlag")
    @Protobuf
	private String hedgeFlag;
    @Column(name = "PosID")
    @Protobuf
	private String posID;
    @Column(name = "ExexSeq")
    @Protobuf
	private Integer exexSeq;
    @Column(name = "WorkingQty")
    @Protobuf
	private Integer workingQty;
    @Column(name = "UnWorkingQty")
    @Protobuf
	private Integer unWorkingQty;
    @Column(name = "CancelQty")
    @Protobuf
	private Integer cancelQty;
    @Column(name = "ExeQty")
    @Protobuf
	private Integer exeQty;

    public TradeSimOrderQuene() {
    }

    public TradeSimOrderQuene(Integer orderID) {
        this.orderID = orderID;
    }

    public TradeSimOrderQuene(Integer orderID, String accountCode, String dealerUserID, Date time, Date tradeDate, Date dateTime, String obj) {
        this.orderID = orderID;
        this.accountCode = accountCode;
        this.dealerUserID = dealerUserID;
        this.time = time;
		this.timeL = CodeTool.DateToLong(time);
        this.tradeDate = tradeDate;
		this.tradeDateL = CodeTool.DateToLong(tradeDate);
        this.dateTime = dateTime;
		this.dateTimeL = CodeTool.DateToLong(dateTime);
        this.obj = obj;
    }

    public Integer getOrderID() {
        return orderID;
    }

    public void setOrderID(Integer orderID) {
        this.orderID = orderID;
    }

    public String getOrdertype() {
        return ordertype;
    }

    public void setOrdertype(String ordertype) {
        this.ordertype = ordertype;
    }

    public String getAccountCode() {
        return accountCode;
    }

    public void setAccountCode(String accountCode) {
        this.accountCode = accountCode;
    }

    public String getDealerUserID() {
        return dealerUserID;
    }

    public void setDealerUserID(String dealerUserID) {
        this.dealerUserID = dealerUserID;
    }

    public Date getTime() {
        return time;
    }

    public void setTime(Date time) {
        this.time = time;
        this.setTimeL(CodeTool.DateToLong(time));
    }

    public Date getTradeDate() {
        return tradeDate;
    }

    public void setTradeDate(Date tradeDate) {
        this.tradeDate = tradeDate;
		this.setTradeDateL(CodeTool.DateToLong(tradeDate));
    }

    public Date getDateTime() {
        return dateTime;
    }

    public void setDateTime(Date dateTime) {
        this.dateTime = dateTime;
		this.setDateTimeL(CodeTool.DateToLong(dateTime));
    }

    public String getMac() {
        return mac;
    }

    public void setMac(String mac) {
        this.mac = mac;
    }

    public Integer getIp4() {
        return ip4;
    }

    public void setIp4(Integer ip4) {
        this.ip4 = ip4;
    }

    public String getObj() {
        return obj;
    }

    public void setObj(String obj) {
        this.obj = obj;
    }

    public String getMarketCode() {
        return marketCode;
    }

    public void setMarketCode(String marketCode) {
        this.marketCode = marketCode;
    }

    public String getClassCode() {
        return classCode;
    }

    public void setClassCode(String classCode) {
        this.classCode = classCode;
    }

    public String getBs() {
        return bs;
    }

    public void setBs(String bs) {
        this.bs = bs;
    }

    public String getOpenClose() {
        return openClose;
    }

    public void setOpenClose(String openClose) {
        this.openClose = openClose;
    }

    public String getPriceType() {
        return priceType;
    }

    public void setPriceType(String priceType) {
        this.priceType = priceType;
    }

    public Float getOrderPrice() {
        return orderPrice;
    }

    public void setOrderPrice(Float orderPrice) {
        this.orderPrice = orderPrice;
    }

    public Integer getOrderQty() {
        return orderQty;
    }

    public void setOrderQty(Integer orderQty) {
        this.orderQty = orderQty;
    }

    public String getHedgeFlag() {
        return hedgeFlag;
    }

    public void setHedgeFlag(String hedgeFlag) {
        this.hedgeFlag = hedgeFlag;
    }

    public String getPosID() {
        return posID;
    }

    public void setPosID(String posID) {
        this.posID = posID;
    }

    public Integer getExexSeq() {
        return exexSeq;
    }

    public void setExexSeq(Integer exexSeq) {
        this.exexSeq = exexSeq;
    }

    public Integer getWorkingQty() {
        return workingQty;
    }

    public void setWorkingQty(Integer workingQty) {
        this.workingQty = workingQty;
    }

    public Integer getUnWorkingQty() {
        return unWorkingQty;
    }

    public void setUnWorkingQty(Integer unWorkingQty) {
        this.unWorkingQty = unWorkingQty;
    }

    public Integer getCancelQty() {
        return cancelQty;
    }

    public void setCancelQty(Integer cancelQty) {
        this.cancelQty = cancelQty;
    }

    public Integer getExeQty() {
        return exeQty;
    }

    public void setExeQty(Integer exeQty) {
        this.exeQty = exeQty;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (orderID != null ? orderID.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof TradeSimOrderQuene)) {
            return false;
        }
        TradeSimOrderQuene other = (TradeSimOrderQuene) object;
        if ((this.orderID == null && other.orderID != null) || (this.orderID != null && !this.orderID.equals(other.orderID))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.jili.ubert.dao.db.TradeSimOrderQuene[ orderID=" + orderID + " ]";
    }

    public long getTimeL() {
        return timeL;
    }

    public void setTimeL(long timeL) {
        this.timeL = timeL;
    }

    public long getTradeDateL() {
        return tradeDateL;
    }

    public void setTradeDateL(long tradeDateL) {
        this.tradeDateL = tradeDateL;
		this.tradeDate = CodeTool.LongToDate(tradeDateL);
    }

    public long getDateTimeL() {
        return dateTimeL;
    }

    public void setDateTimeL(long dateTimeL) {
        this.dateTimeL = dateTimeL;
		this.dateTime = CodeTool.LongToDate(dateTimeL);
    }
    
}
